package com.example.oj.controller;

import com.example.oj.mapper.SysEnumsMapper;
import com.example.oj.service.SysEnumsService;
import com.example.oj.service.SysOptionService;
import com.example.ojcommon.common.BaseResponse;
import com.example.ojcommon.common.ResultUtils;
import com.example.ojcommon.enums.LanguageEnum;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/common")
public class CommonController {

    @Resource
    private SysEnumsService sysEnumsService;

    @Resource
    private SysOptionService sysOptionService;

    @GetMapping("/getEnum")
    public BaseResponse<List<Map<String,Object>>> getEnumsList(String type){
        List<Map<String, Object>> enumsList = sysEnumsService.getEnumsList(type);
        return ResultUtils.success(enumsList);
    }

    @GetMapping("/getOption")
    public BaseResponse<List<Map<String,Object>>> getOptionsList(String type){
        List<Map<String, Object>> optionsList = sysOptionService.getOptionsList(type);
        return ResultUtils.success(optionsList);
    }

}
